#include "processbar.h"

#define Length 101
const char symbol = '=';
const char* cart = "|\\-/";

void  ProcBar(double current, double total)
{
  double percent = 100 * current / total;
  int num = (int)percent;
  int cur = 0;
  char arr[Length] = "\0";
  memset(arr, '\0', Length);
  while(cur < num)
  {
    arr[cur++] = symbol;
  }
  printf("[%-100s][%.1f%%][%c]\r", arr, percent, cart[num % 4]);
  fflush(stdout);
}
